// 1.0 导入vue核心包
import Vue from 'vue';

// 2.0 导入App.vue的vue对象
import App from './App.vue';

// 3.0 将vue-router集成到这个项目中来
import vueRouter from 'vue-router';
// 3.0.1 将vueRouter对象绑定到Vue对象上
Vue.use(vueRouter);

// 3.0.2 导入路由规则对应的组件对象
import login from './components/account/login.vue';
import register from './components/account/register.vue';
import Home from './components/Home.vue';
import shopcar from './components/shopcar/car.vue';
import newslist from "./components/news/newslist.vue";
import newsinfo from "./components/news/newsinfo.vue";
import photolist from "./components/photos/photolist.vue";
import photoinfo from './components/photos/photoinfo.vue'
// 3.0.2 定义路由规则
var router1 = new vueRouter({
	linkActiveClass: 'mui-active',
	routes: [
		{ path: '/', redirect: '/home' },//redirect重定向
		{ path: '*', redirect: '/home' },//*代表匹配不到的路由,也跳到首页
		{ path: '/home', component: Home },
		{ path: '/car', component: shopcar },
		{ path: '/news/newlist', component: newslist },
		{ path: '/news/newsinfo/:id', component: newsinfo },
		{ path: '/photos/photolist', component: photolist },
		{ path: '/photos/photoinfo/:id', component: photoinfo }
	]
});

//引入site.css文件
import '../statics/css/site.css'
// 4.0 注册mint-ui
// 导入mint-ui的css文件
// import 'mint-ui/lib/style.min.css';
import 'mint-ui/lib/style.min.css';
// 导入mint-ui组件对象
// import mintui from 'mint-ui';
import mintui from 'mint-ui';
// 在Vue中全局使用mintui
/*  Vue.component()把mint里的组件注册到Vue中
 如'mt-header' */
// Vue.use(mintui);
Vue.use(mintui);
//引入图片预览插件vue-preview
import VuePreview from 'vue-preview'
Vue.use(VuePreview)
//将vue-resourse引入
import vueResource from 'vue-resource'
Vue.use(vueResource); //Vue.prototype.$http = vueResource
// 5.0 注册mui的css样式
// import '../statics/mui/css/mui.css';
import '../statics/mui/css/mui.css';

//引入moment.js 来格式化日期
import moment from 'moment';

//自定义全局过滤器
Vue.filter("date", function (input, fmtstring) {
	return moment(input).format(fmtstring)
})


//引入kits 里的第三方技术文件,common.js
import common from './kits/common.js'
//绑定到Vue 上
Vue.prototype.$common = common;

// 5.0 利用Vue对象进行解析渲染
new Vue({
	el: '#app',
	// 使用路由对象实例
	router: router1,
	// render:function(create){create(App)} //es5的写法
	render: c => c(App)  // es6的函数写法 =>：goes to
});